<?php
/**
 * Created by PhpStorm.
 * User: u
 * Date: 2019/4/10
 * Time: 11:00
 */
namespace common\sources\write\busdepositrecord;

use Yii;

class BusDepositRecordAccess implements IBusDepositRecordAccess
{
      public function addBusDepositRecord($data)
      {
          return Yii::$app->db->createCommand()->insert('business_deposit_record', [
              'bus_id' =>  $data['bus_id'],
              'task_commod_id' => $data['task_commod_id'],
              'task_id' => $data['task_id'],
              'task_order_id' => $data['task_order_id'],
              'task_order_num' => $data['task_order_num'],
              'type' => $data['type'],
              'expend' => $data['expend'],
              'income' => $data['income'],
              'balance' => $data['balance'],
              'freeze_change' => isset($data['freeze_change']) ? $data['freeze_change'] : 0,
              'freeze_balance' => isset($data['freeze_balance']) ? $data['freeze_balance'] : 0,
              'remark' => $data['remark'],
              'operatorId' => isset($data['operatorId']) ? $data['operatorId'] : '',
              'create_time' => time()
          ])->execute();
      }

    public function addDepositRecord($data)
    {
        return Yii::$app->db->createCommand()->insert('business_deposit_record', [
            'bus_id' => $data['bus_id'],
            'task_commod_id' => isset($data['task_commod_id']) ? $data['task_commod_id'] : '0',
            'task_id' => isset($data['task_id']) ? $data['task_id'] : '0',
            'order_id' => isset($data['order_id']) ? $data['order_id'] : '0',
            'task_order_id' => isset($data['task_order_id']) ? $data['task_order_id'] : '0',
            'task_order_num' => isset($data['task_order_num']) ? $data['task_order_num'] : '0',
            'type' => $data['type'],
            'expend' => $data['expend'],
            'income' => $data['income'],
            'balance' => $data['balance'],
            'freeze_change' => isset($data['freeze_change']) ? $data['freeze_change'] : 0,
            'freeze_balance' => isset($data['freeze_balance']) ? $data['freeze_balance'] : 0,
            'remark' => $data['remark'],
            'tran_num' => isset($data['tran_num']) ? $data['tran_num'] : '',
            'operatorId' => isset($data['operatorId']) ? $data['operatorId'] : '',
            'create_time' => time()
        ])->execute();
    }
}